extends TextureButton
class_name Coin

@export var index: int = 0:
	set(val):
		if index != val:
			index = val
		$Label.text = str(val + 1)

signal coin_selected(index: int, pressed: bool)

func _ready() -> void:
	$Label.text = str(index + 1)

func _on_pressed() -> void:
	coin_selected.emit(index, button_pressed)

	
func deactivate() -> void:
	disabled = true
	modulate = Color(1, 1, 1, 0.5)
	
	
func activate() -> void:
	disabled = false
	modulate = Color(1, 1, 1, 1)
